package com.study.a06mySet;

import java.util.LinkedHashSet;

public class A03_LinedHashSetDemo {
    public static void main(String[] args) {

        Student s1 = new Student("张三",18);
        Student s2 = new Student("李四",28);
        Student s3 = new Student("王五",13);
        Student s4 = new Student("张三",18);

        //可以保证数据存储顺序
        LinkedHashSet<Student> lhs = new LinkedHashSet<>();

        System.out.println(lhs.add(s1));
        System.out.println(lhs.add(s2));
        System.out.println(lhs.add(s3));
        System.out.println(lhs.add(s4));


        System.out.println(lhs);
    }
}
